cmake_minimum_required (VERSION 3.12)
PROJECT(demo99)
##  配置，选项

## 依赖, 第三方库
if( NOT yate_engine_lib )
	FIND_PACKAGE(Yate REQUIRED )
	SET( yate_engine_lib ${Yate_LIBRARIES} )
	INCLUDE_DIRECTORIES( ${Yate_INCLUDE_DIR} )
endif()

SET( CMAKE_CXX_STANDARD 11 )

# Generate position-independent code (-fPIC on UNIX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

## 使用UTF-8编码，
ADD_COMPILE_OPTIONS("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
ADD_COMPILE_OPTIONS("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

## 头文件目录
INCLUDE_DIRECTORIES( 
	./
)

## 源文件
SET(PRJ_SOURCE_FILES
	demo99.cpp
)

SOURCE_GROUP(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${PRJ_SOURCE_FILES})
# 设置符号导出为隐藏方式
SET(CMAKE_C_VISIBILITY_PRESET hidden)
SET(CMAKE_CXX_VISIBILITY_PRESET hidden)
SET( YATE_MODULE_TARGET demo99)  ## ${YATE_MODULE_TARGET}

ADD_LIBRARY( ${YATE_MODULE_TARGET} SHARED
	${PRJ_SOURCE_FILES}
)

## 链接Yate库
TARGET_LINK_LIBRARIES( ${YATE_MODULE_TARGET} 
	PRIVATE ${yate_engine_lib} 
)

SET_PROPERTY(TARGET ${YATE_MODULE_TARGET} PROPERTY FOLDER "modules-demo")
## 设置插件的后缀为.yate 
SET_TARGET_PROPERTIES(${YATE_MODULE_TARGET} PROPERTIES SUFFIX ".yate")
SET_TARGET_PROPERTIES(${YATE_MODULE_TARGET} PROPERTIES PREFIX "")

INSTALL (TARGETS ${YATE_MODULE_TARGET} LIBRARY DESTINATION modules )

